package com.javasm.transfer;

import com.javasm.domin.entity.AftersaleEnter;
import com.javasm.domin.vo.AftersaleEnterVo;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.javasm.common.dictionary.AfterinitContext.afdic;

@Component
@RequiredArgsConstructor
public class AftersaleEnterTransfer extends BaseTransfer<AftersaleEnter, AftersaleEnterVo> {

    public List<AftersaleEnterVo> jotoVo(List<AftersaleEnter> list){
        List<AftersaleEnterVo> aftersaleEnterVos = super.toVO(list);

        for (int i = 0; i < aftersaleEnterVos.size(); i++) {
            //拿到AftersaleOut对象
            AftersaleEnter aftersaleEnter = list.get(i);
            AftersaleEnterVo aftersaleEnterVo = aftersaleEnterVos.get(i);
            if(aftersaleEnter.getEnterSignId()!=null&&aftersaleEnter.getEnterSignId()!=0){
                aftersaleEnterVo.setEnterSignName(afdic.get(1).get(aftersaleEnter.getEnterSignId()));
            }
            if(aftersaleEnter.getBatchState()!=null&&aftersaleEnter.getBatchState()!=0){
                aftersaleEnterVo.setBatchStatename(afdic.get(2).get(aftersaleEnter.getBatchState()));
            }
            if(aftersaleEnter.getNumberState()!=null&&aftersaleEnter.getNumberState()!=0){
                aftersaleEnterVo.setNumberState(afdic.get(3).get(aftersaleEnter.getNumberState()));
            }

        }

        return aftersaleEnterVos;
    }
}
